package com.example.mapper;

import com.example.pojo.Course;
import com.example.pojo.ParseStudent;
import com.example.pojo.Student;
import org.apache.ibatis.annotations.*;

import java.util.Vector;

@Mapper
public interface StudentMapper {
    /*
    * 学生注册
    * */
    @Insert("insert into student value (#{id},#{name},#{aaClass})")
    public void addStudent(String id, String name, String aaClass);

    @Insert("insert into user_pass value (#{id},#{passwd},'2')")
    void addStudentPasswd(String id, String passwd);

    @Select("select student.id,name,aaClass,course,score from score right join student on score.student=student.name  order by student.id")
    Vector<ParseStudent> select();


    Vector<ParseStudent> selectStudent(String id, String aaClass, String teacher,String name);

    @Update(" update student,score set score.score=#{score} " +
            "where student.id=#{id} and score.id=#{id} and score.course=#{course}")
    void update(String name,String aaClass,String course,String score,String id);

    @Delete("delete from score where id=#{id}")
    void delete_1(String id);

    @Delete("delete from student where id=#{id}")
    void delete_2(String id);

    @Insert("insert into course_select value (#{id},#{course},#{name})")
    void studentCourse(String id,String course,String name);

    @Insert("insert into score value (#{sid},#{name},#{course},#{score})")
    void studentScore(String sid, String name,String course,String score);
}
